﻿using System;
using System.IO;
using kk.components.contracts;
namespace kk.preiskategorieadapter.filereader
{
    public class ReadFile : IReadFile
    {

        public string[] GetLines(string filename)
        {
            string[] lines;
            if (string.IsNullOrEmpty(filename)) return null;
            try
            {
                lines = File.ReadAllLines(filename);
            }
            catch (FileNotFoundException)
            {
                return null;
            }
            return lines;
        }
    
        public void ProcessKategorieadpaterReadFile(Request<string, string[]> requestByPreiskategorieadpter)
        {
            requestByPreiskategorieadpter.ResponsePin(GetLines(requestByPreiskategorieadpter.RequestData));
        }
    }
}
